/*
 * Copyright 2012 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package org.chacha.client.command;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;

/**
 *  pojo和json转换接口
 *	@author: hejing
 *	@date: 2012-11-30-下午03:41:47
 */
public interface JsonConvert {
	/**
	 * 对象转换为json格式字符串
	 * @param o
	 * @return json格式字符串
	 * @throws IOException 
	 * @throws JsonGenerationException 
	 * @throws JsonMappingException 
	 */
	public String toJson() throws JsonMappingException, JsonGenerationException, IOException;
	/**
	 * 从json字串解析为对象
	 * @param json
	 * @return	对象
	 * @throws IOException 
	 * @throws JsonParseException 
	 * @throws JsonMappingException 
	 */
	public void fromJson(String json) throws JsonMappingException, JsonParseException, IOException;
}
